<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>店铺列表</title>
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link href="../css/mui.min.css" rel="stylesheet" />
    <link href="../phoneCss/commons.css" rel="stylesheet" />
    <link href="../phoneCss/confirmOrder.css" rel="stylesheet" />
    <style>
        body,.mui-content{
            background: #fff;
        }
        .address{
            border-bottom: 1px solid #f1f1f1;
            padding-bottom: 20px;
        }
        .address_more{
            float: right;
        }
        .address_more img{
            float: right;
            width: 5px;
            margin-right: 12.5px;
            vertical-align: middle;
            margin-top: 4px;
        }
    </style>
</head>
<body>
<!--
    作者：lwy
    时间：2017-11-10
    描述：店铺列表
-->
<header class="mui-bar mui-bar-nav">
    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
    <h1 class="mui-title">店铺列表</h1>
</header>

<div class="mui-content">
    <div class="addressBox mui-clearfix">
        <!--<div class="address_icon"><img src="../img/address_icon.png" alt="地址"></div>-->
        <!--<div class="address_info">-->
            <!--<div class="user_info">联系人<span class="name">名字</span><span class="phone"></span></div>-->
            <!--<div class="address_detail">详细地址</div>-->
        <!--</div>-->
    </div>
</div>


<script src="../js/mui.min.js"></script>
<script src="../js/jquery-1.10.1.min.js"></script>
<script src="../phoneJs/ifApp.js"></script>
<script>
    document.write("<s" + "cript type='text/javascript' src='../js/common.js?" + Math.random() + "'></scr" + "ipt>");
</script>
<script type="text/javascript">
    var isIos = 0;

    $(function () {
        //ios
        setupWebViewJavascriptBridge(function(bridge) {
            /* Initialize your app here */
            bridge.callHandler('getDevice', function(responseData) {
                isIos = 1;
            })
        })
        $.ajax({
            url:'/ddmShopC/getPortalShopList.json',
            dataType:'json',
            data:{
                page:1,
                companyCode:getItem('companyCode'),
            },
            type:'post',
            success:function (data) {
                if(data.code==1){
                    for(var i=0;i<data.datas.length;i++){
                        $('<div class="address mui-clearfix" lnt="'+data.datas[i].longitudeAndLatitude+'"><div class="address_icon"><img src="../phoneImg/address.png" alt="地址"></div>\n' +
                            '<div class="address_more"><img src="../phoneImg/me_more_icon.png" alt=""></div>'+
                            '<div class="address_info">\n' +
                            '<div class="user_info">联系人<span class="name">'+data.datas[i].linkman+'</span><span class="phone">'+data.datas[i].contact+'</span></div>\n' +
                            '<div class="address_detail">'+data.datas[i].name+' '+data.datas[i].location+'</div>\n' +
                            '</div></div>').appendTo($('.addressBox'))
                    }
                    $('.address').click(function () {
                        var selThis = $(this);
                        if(ifApp()==0){
                            address()
                        }else if(ifApp()==1){
                            if(isIos==1){
                                //ios
                                setupWebViewJavascriptBridge(function(bridge) {
                                    /* Initialize your app here */
                                    bridge.callHandler('navigationToShop', selThis.attr('lnt'),function(responseData) {

                                    })
                                })
                            }else{
                                address();
                            }
                        }else{
                            address();
                        }
                        function address() {
                            var shopAddress = {};
                            shopAddress.name = selThis.find('.name').html();
                            shopAddress.phone = selThis.find('.phone').html();
                            shopAddress.detail = selThis.find('.address_detail').html();
                            shopAddress.lnt = selThis.attr('lnt');
                            setItem('shopAddress2',JSON.stringify(shopAddress));
                            window.location.href="map2.html"
                        }
                    })

                }
                if(data.code==0){
                    mui.toast(data.msg);
                }
            }
        })
    })
</script>
</body>
</html>
